<!--
* @Description: 数据字典 - 表单
* @Author: DSY
* @Date: 2022-03-19 22:53:48
 * @LastEditors: DHL
 * @LastEditTime: 2022-08-31 13:25:40
-->
<template>
  <tw-dialog
    v-model="visible"
    :title="title"
    :loading="loading"
    width="800px"
    height="500px"
    @close="handleClose"
  >
    <el-form ref="dbFormRef" :model="dbForm" :rules="rules" label-width="90px">
      <el-row>
        <el-col :span="24">
          <el-form-item label="上级字典" prop="parentId">
            <el-input
              v-model="myData.parentName"
              :disabled="true"
              placeholder="请选择上级字典"
            ></el-input>
          </el-form-item>
        </el-col>

        <el-col :span="24">
          <el-divider />
        </el-col>

        <el-col :span="12">
          <el-form-item label="类别编码" prop="typeCode">
            <el-input v-model="dbForm.typeCode" clearable placeholder="请输入类别编码"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="类别名称" prop="typeName">
            <el-input v-model="dbForm.typeName" clearable placeholder="请输入类别名称"></el-input>
          </el-form-item>
        </el-col>

        <el-col :span="24">
          <el-divider />
        </el-col>

        <el-col :span="12">
          <el-form-item label="字典值" prop="dataValue">
            <el-input v-model="dbForm.dataValue" clearable placeholder="请输入字典值"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="字典值名称" prop="dataName">
            <el-input v-model="dbForm.dataName" clearable placeholder="请输入字典值名称"></el-input>
          </el-form-item>
        </el-col>

        <el-col :span="24">
          <el-divider />
        </el-col>

        <el-col :span="12">
          <el-form-item label="字典样式" prop="cssName">
            <el-select v-model="dbForm.cssName" clearable placeholder="请选择字典样式">
              <tw-dic dicKey="CSS_NAME"></tw-dic>
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="顺序号" prop="seqNum">
            <el-input-number v-model="dbForm.seqNum" clearable placeholder="请输入顺序号" />
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="英文名称" prop="dataNameEn">
            <el-input v-model="dbForm.dataNameEn" clearable placeholder="请输入英文名称"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="助记码" prop="smartCode">
            <el-input v-model="dbForm.smartCode" clearable placeholder="请输入助记码"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="扩展1" prop="tag1">
            <el-input v-model="dbForm.tag1" clearable placeholder="请输入扩展1"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="扩展2" prop="tag2">
            <el-input v-model="dbForm.tag2" clearable placeholder="请输入扩展2"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="扩展3" prop="tag3">
            <el-input v-model="dbForm.tag3" clearable placeholder="请输入扩展3"></el-input>
          </el-form-item>
        </el-col>

        <el-col :span="24">
          <el-form-item label="描述" prop="remark">
            <el-input v-model="dbForm.remark" clearable placeholder="请输入描述"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <template #footer>
      <el-button @click="handleReset(true)">取 消</el-button>
      <el-button v-if="action === 'add'" type="warning" @click="handleSubmit(true)">
        提交并继续
      </el-button>
      <el-button v-if="action !== 'view'" type="primary" @click="handleSubmit(false)">
        提 交
      </el-button>
    </template>
  </tw-dialog>
</template>

<script src="./useForm.ts"></script>

<style scoped lang="scss">
  .el-divider--horizontal {
    margin: 0px 0px 20px;
  }
</style>
